#include <cstdio>

int main() {
	int f[11], n;
    f[0] = 1;
    for(int i = 1; i < 11; i++) {
        f[i] = f[i-1] * i;
    }

    while( scanf("%d", &n) == 1 ) {
        if(n == 0) {
        	printf("NO\n");
        	continue;
        }
        else {
            for(int i = 10; i >= 0; i--) {
                if(n >= f[i])
                	n -= f[i];
            }
            if(n == 0) {
            	printf("YES\n");
            	continue;
            }
            else {
            	printf("NO\n");
            	continue;
            }
        }
    }
    return 0;
}